package com.terrynoya.fight.combat
{
	import com.terrynoya.fight.emuns.StateTypeEnum;
	import com.terrynoya.fight.stateMachine.triggers.StateType;

	public class CharacterDimension
	{
		private var _groundFrontWidth:int;
		private var _groundBackWidth:int;
		
		private var _backWidthOverride:int;
		private var _frontWidthOverride:int;
		
		private var _airFrontWidth:int;
		private var _airBackWidth:int;
		
		private var _backEdgeWidth:int;
		private var _frontEdgeWidth:int;
		
		private var _height:int;
		
		public function CharacterDimension()
		{
			this._backWidthOverride = 0;
			this._frontWidthOverride = 0;
		}

		public function get frontEdgeWidth():int
		{
			return _frontEdgeWidth;
		}

		public function set frontEdgeWidth(value:int):void
		{
			_frontEdgeWidth = value;
		}

		public function get backEdgeWidth():int
		{
			return _backEdgeWidth;
		}

		public function set backEdgeWidth(value:int):void
		{
			_backEdgeWidth = value;
		}

		public function get groundBackWidth():int
		{
			return _groundBackWidth;
		}

		public function set groundBackWidth(value:int):void
		{
			_groundBackWidth = value;
		}

		public function get groundFrontWidth():int
		{
			return _groundFrontWidth;
		}

		public function set groundFrontWidth(value:int):void
		{
			_groundFrontWidth = value;
		}

		public function get height():int
		{
			return _height;
		}

		public function set height(value:int):void
		{
			_height = value;
		}
		
		public function getFrontWidth(stateType:int):int
		{
			var w:int = this._frontWidthOverride;
			switch(stateType)
			{
				case StateTypeEnum.Standing:
				case StateTypeEnum.Prone:
				case StateTypeEnum.Crouching:
				{
					w += this._groundFrontWidth;
					break;
				}
				case StateTypeEnum.Airborne:
				{
					w += this._airFrontWidth;
				}
			}
			return w;
		}
		
		public function getBackWidth(stateType:int):int
		{
			var w:int = this._backWidthOverride;
			switch(stateType)
			{
				case StateTypeEnum.Standing:
				case StateTypeEnum.Prone:
				case StateTypeEnum.Crouching:
				{
					w += this._groundBackWidth
					break;
				}
				case StateTypeEnum.Airborne:
				{
					w += this._airBackWidth;
				}
			}
			return w;
		}
	}
}